<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script type="text/javascript">
	$(function() {
		
		$('#parentPurId').combotree({
			url : '${ctx}/purview/getTreeNoChild?pId='+'${purView.purId}',
			parentField : 'pid',
			lines : true,
			panelHeight : 'auto',
			 onLoadError:function(e){
					parent.$.messager.alert('错误',"获取上级权限点数据失败，服务器错误！", 'error');
			},
			value : '${purView.parentPurId}'
		});
		var parentPurid=$('input[name=parentPurid]').val();
		if(parentPurid=='0'){
			$('#parentPurId').combotree('clear');
		}
		$('#purViewEditForm').form({
			//async: false,
			url : '${ctx}/purview/editPurView',
			onSubmit : function() {
				progressLoad();
				var isValid = $(this).form('validate');
				if (!isValid) {
					progressClose();
				}
				return isValid;
			},
			success : function(result) {
				progressClose();
				var res=result.toString();
				if (res=='修改成功') {
					parent.$.messager.show({
						showType:'fade',
					    showSpeed:600,
					    width:300,
					    height:126,
					    msg:'修改成功，请在角色管理界面重新为当前角色授权！',
					    title:'提示',
					    timeout:1000,
					    style:{
							right:'',
							top:'200px',
							bottom:'',
						}
					    });
					parent.$.modalDialog.openner_treeGrid.treegrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_treeGrid这个对象，是因为pueViewList.jsp页面预定义好了
					parent.$.modalDialog.handler.dialog('close');
				}else{
					parent.$.messager.alert('错误', result, 'error');
				}
			}
		});
		
		$("#purTypeMode").val('${purView.purType}');
		
	});
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div style="padding: 3px;">
	<form id="purViewEditForm" method="post">
		<table  class="grid">
			<tr>
				<td>权限点名称</td>
				<td><input name="purId" type="hidden"  value="${purView.purId}" >
				<input name="purName" type="text" placeholder="请输入权限点名称" value="${purView.purName}" class="easyui-validatebox span2" data-options="required:true" ><font color="red" style="font-weight:bold;" face="verdana">*</font></td>
				<td>类型</td>
				<td><select id="purTypeMode" name="purType" class="easyui-combobox"  data-options="width:140,height:29,editable:false,panelHeight:'auto',required:true">
					 <c:forEach items="${purView.purTypes}" var="purType">
					 <option value="${purType.ddvCode}">${purType.value}</option>
					</c:forEach>		
				</select></td>
			</tr>
			<tr>
				<td>访问路径</td>
				<td><input name="purValue" id="purValue" type="text" value="${purView.purValue}" placeholder="请输入访问路径" class="easyui-validatebox span2"></td>
				<td>图标</td>
				<td ><input  name="icon" value="${purView.icon}"/></td>
			</tr>
			<tr>
				<td>权限点编码</td>
				<td><input name="purCode" type="text" placeholder="请按照规则填写code" value="${purView.purCode}" class="easyui-validatebox span2" data-options="required:true,width:140,height:29,required:true" ><font color="red" style="font-weight:bold;" face="verdana">*</font></td>
			</tr>
			
			<tr>
				<td>上级权限点</td>
				<td colspan="3"><select id="parentPurId"  name="parentPurId" style="width: 200px; height: 29px;"></select>
				<a class="easyui-linkbutton" href="javascript:void(0)" onclick="$('#parentPurId').combotree('clear');" >清空</a></td>
			</tr>
		</table>
	</form>
</div>
